|
Расположение в меню |
---|
Эскиз → Ограничения эскиза → Ограничение преломления (Закон Снеллиуса) |
Верстаки |
Скетчер |
Быстрые клавиши |
K W |
Представлено в версии |
0.15 |
См. также |
Нет |
Инструмент Ограничение преломления (Закон Снеллиуса) ограничивает две линии, чтобы они следовали закону преломления света, когда он проникает через границу раздела двух материалов с разными показателями преломления. Смотри Закон Снеллиуса (англ.), (рус.)
Закон Снеллиуса
Последовательность щелчков обозначена жёлтыми стрелками с цифрами, n1 и n2 показывают, где находятся показатели преломления
The constraints can be created from macros and from the Python console by using the following function:
Sketch.addConstraint(Sketcher.Constraint('SnellsLaw',line1,pointpos1,line2,pointpos2,interface,n2byn1))
where:
Sketch
is a sketch objectline1
and pointpos1
are two integers identifying the endpoint of the line in medium with refractive index of n1. line1
is the line's index in the sketch (the value, returned by Sketch.addGeometry), and pointpos1
should be 1 for start point and 2 for end point.line2
and pointpos2
are the indexes specifying the endpoint of the second line (in medium n2)interface
is the index specifying the line indicating the position of the interface between medium n1 and medium n2n2byn1
is a floating-point number equal to the ratio of refractive indices n2/n1The Sketcher scripting page explains the values which can be used for line1
, pointpos1
, line2
, pointpos2
and interface
and contains further examples on how to create constraints from Python scripts.
Пример:
import Sketcher
import Part
import FreeCAD
StartPoint = 1
EndPoint = 2
f = App.activeDocument().addObject("Sketcher::SketchObject","Sketch")
# add geometry to the sketch
icir = f.addGeometry(Part.Circle(App.Vector(-547.612366,227.479736,0),App.Vector(0,0,1),68.161979))
iline1 = f.addGeometry(Part.LineSegment(App.Vector(-667.331726,244.127090,0),App.Vector(-604.284241,269.275238,0)))
iline2 = f.addGeometry(Part.LineSegment(App.Vector(-604.284241,269.275238,0),App.Vector(-490.940491,256.878265,0)))
# add constraints
# helper constraints:
f.addConstraint(Sketcher.Constraint('Coincident',iline1,EndPoint,iline2,StartPoint))
f.addConstraint(Sketcher.Constraint('PointOnObject',iline1,EndPoint,icir))
# the Snell's law:
f.addConstraint(Sketcher.Constraint('SnellsLaw',iline1,EndPoint,iline2,StartPoint,icir,1.47))
App.ActiveDocument.recompute()